<?php

use Hyperf\Database\Schema\Schema;
use Hyperf\Database\Schema\Blueprint;
use Hyperf\Database\Migrations\Migration;

class CreateTagsTable extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('tags', function (Blueprint $table) {
            $table->bigIncrements('id')->unsigned();
            $table->string('name', 50)->unique()->comment('标签名称');
            $table->string('slug', 50)->unique()->comment('标签标识');
            $table->text('description')->nullable()->comment('标签描述');
            $table->string('color', 7)->default('#409EFF')->comment('标签颜色');
            $table->unsignedInteger('article_count')->default(0)->comment('文章数量');
            $table->timestamps();

            $table->comment('标签表');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('tags');
    }
}
